﻿/**
* Description 版权所有2006@qz http://www.quick35.com
* @author crlnet
* @version 1.1
*/

package com.crlclr.utils{
	
	import flash.display.DisplayObject;
	public class FileInfo {
		
		/**
		* 
		* @param	mc
		* @param	isLoader
		*/
		public static function relativelyBy (mc:DisplayObject,isLoader:Boolean=false):String {
			
			var path:String
			
			if(isLoader){
				path= mc.loaderInfo.loaderURL;
			}else{
				path= mc.loaderInfo.url;
			}
			
			var sublen:Number = path.lastIndexOf ("/") + 1;
			path = path.substr (0, sublen);
			return path;
			
		}
		
		/**
		* 判断文件是相对路径还是决对路径;
		* @param	path
		*/
		public static function isOnlineFile(path:String):Boolean{
			var i:int=path.indexOf(":");
			if(i>-1){
				return true;
			}
			
			var online:String = path.split(":")[0];
			if(online == "http" || online == "https") return true;
			else return false;
		}
		
	}
	
}
